<?php

namespace App\Http\Controllers;

use App\Article;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class DownloadController extends Controller
{
    public function index(Request $request, $file)
    {
        $filePath = 'upload/' . iconv('utf-8', 'gb2312', $file);
        header('content-disposition:attachment;filename='.$file);
        header('content-length:'.filesize($filePath));
        readfile($filePath);
    }
}